package system.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 用户感知信息查询对象
 */
@Data
public class UserSenseQuery {
    @ApiModelProperty(value = "用户ID")
    private Long id;
    @ApiModelProperty(value = "姓名")
    private String name;
    @ApiModelProperty(value = "用户名")
    private String username;
    @ApiModelProperty(value = "手机号")
    private String mobile;
    @ApiModelProperty(value = "邮箱")
    private String mail;
    @ApiModelProperty(value = "匹配模式:0 前导模糊，1 模糊，2 完全匹配")
    private Integer matchMode = 0;

    /**
     * 是否未输入任务值
     *
     * @return
     */
    public boolean checkEmpty() {
        boolean noUserId = this.getId() == null || this.getId().equals(0L);
        boolean noUserName = StringUtils.isBlank(this.getUsername());
        boolean noName = StringUtils.isBlank(this.getName());
        boolean noMobile = StringUtils.isBlank(this.getMobile());
        boolean noMail = StringUtils.isBlank(this.getMail());
        //
        return noUserId && noUserName && noName && noMobile && noMail;
    }
}
